<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<jsp:include page="../head.jsp">
<jsp:param value="${empty dept ?'新增部门':'修改部门' }" name="title"/>
</jsp:include>
<script type="text/javascript">
$(function(){
	$('.selection.dropdown,select.dropdown').dropdown();
});
</script>
</head>
<body>
			<div class="container">
				<div class="row">
					<div id="content" class="col-lg-12">
					<div class = "dao">		
					  <a class="section" href = "dept/form">部门管理</a>
					  <i class="right chevron icon divider"></i>
					  <span class="active section">${empty dept ?'新增部门':'修改部门' }</span>						
					</div>
					
					<form  method="post" class="ui form create-form content" >
						<!-- 如果是新建这里没有值 -->
					  <input type="hidden" name="id" value="${dept.dept_id }">
					  <input type="hidden" name="status" value="${empty dept ?'创建':'保存' }">
						  <div class="field">
						    <label>部门名称</label>
						    <input type="hidden" name="deptId" value="${dept.dept_id }">
						    <input type="text" name="deptName" value="${dept.dept_name }">
						  </div>
						  
						  <div class="field">
						    <label>部门经理</label>
						    <div class="ui selection dropdown">
						      <input type="hidden" name="deptManager" value="${dept.dept_manager }">
					          <i class="dropdown icon"></i>
					          <div class="default text">请选择经理</div>
					          <div class="menu">
					          	<div class="item" data-value="">请选择经理</div>
					          	 <c:forEach items="${ employee }" var="employee">
					              <div class="item" data-value="${employee.empId }">
						            ${employee.empName }
					              </div>
					              </c:forEach>
					          </div>
					       	</div>
						  </div>
						  
						  <div class="field">
						    <label>上属部门</label>
							<div class="ui selection dropdown">
					          <input type="hidden" name="updeptId" value="${dept.updapt_id }">
					          <i class="dropdown icon"></i>
					          <div class="default text">请选择部门</div>
					          <div class="menu">
					          	<div class="item" data-value="">请选择部门</div>
					          	 <c:forEach items="${ deptList }" var="deptList">
					              <div class="item" data-value="${deptList.dept_id }">
						            ${deptList.dept_name }
					              </div>
					              </c:forEach>
					          </div>
					       	</div>
						  </div>
						  
							  <button class="ui button" type="submit">${empty dept ?'创建':'保存' }</button>
							  <span style="color:red">${error }</span>
							</form>
			
					</div>
				</div>
			</div>
	</div>
</body>
</html>